﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Edit.Master" Inherits="System.Web.Mvc.ViewPage<Langben.DAL.Loading>" %>

<%@ Import Namespace="Common" %>
<%@ Import Namespace="Models" %>
<asp:Content ID="Content4" ContentPlaceHolderID="CurentPlace" runat="server">
    修改触摸屏首页
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>
            <input class="a2 f2" type="button" onclick="Sure()" value="确定" />
            <input class="a2 f2" type="submit" value="修改" style="display: none" id="loadedit" />

        </legend>
        <div class="bigdiv">
            <%: Html.HiddenFor(model => model.RowGuid ) %>
            <div class="editor-label" style="display: none">
                <%: Html.LabelFor(model => model.CreateUser) %>：
            </div>
            <div class="editor-field" style="display: none">
                <%: Html.EditorFor(model => model.CreateUser) %>
                <%: Html.ValidationMessageFor(model => model.CreateUser) %>
                
                <%: Html.LabelFor(model => model.Type) %>：
            
              
                              <%: Html.EditorFor(model => model.Type) %>
                            <%: Html.ValidationMessageFor(model => model.Type) %>
            </div>
            <%: Html.HiddenFor(model => model.CreateTime ) %>
            <div>
                <table style="width: 100%">
                    <tr style="width: 100%">
                        <td style="width: 50%">
                            <%: Html.LabelFor(model => model.Type) %>：
                           <input id="typedisplay" disabled="disabled"/>
                        </td>
                        <td style="width: 50%">
                            <%: Html.LabelFor(model => model.IsDisplay) %>：
                            <%: Html.RadioButtonListFor(model => model.IsDisplay,Models.SysFieldModels.GetSysField("Loading", "IsDisplay"), true) %>

                            <%: Html.ValidationMessageFor(model => model.IsDisplay) %>
                        </td>
                    </tr>
                </table>





            </div>

            <div class="editor-label" style="display: none">
                <%: Html.LabelFor(model => model.UserGuidContent) %>：
            </div>
            <div class="editor-field" style="display: none">
                <%: Html.EditorFor(model => model.UserGuidContent) %>
                <%: Html.ValidationMessageFor(model => model.UserGuidContent) %>
            </div>
        </div>

        <table id="flexigridData">
        </table>



    </fieldset>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">

    <script type="text/javascript">

        $(function () {
            $('#flexigridData').datagrid({
                title: '请选择人员', //列表的标题
                iconCls: 'icon-site',
                //                fit: true, //列表自动适应宽度
                width: 'auto',
                height: 'auto',
                nowrap: false,
                striped: true,
                url: '../../SysPerson/GetAllData', //获取数据的url
                sortName: 'Id',
                sortOrder: 'desc',
                idField: 'Id',
                queryParams: { type: $('#Type').val() },
                columns: [[
                      { field: 'ck', checkbox: true },
					{ field: 'Name', title: '账号名', width: 160 }
					, { field: 'MyName', title: '姓名', width: 160 }
					, { field: 'Sex', title: '性别', width: 160 }
					, { field: 'dep', title: '部门', width: 160 }
					, { field: 'State', title: '账号状态', width: 160 }

                ]],

                rownumbers: true,


                onLoadSuccess: function (data) {
                    if (data) {
                        $.each(data.rows, function (index, item) {
                            if (this.IsLoading > 0) {
                                $('#flexigridData').datagrid('checkRow', index);
                            }
                        });
                    }
                }

            });
            $('#typedisplay').val($('#Type').val());


        });

        function Sure() {
            var rows = $('#flexigridData').datagrid('getSelections');
            if (rows.length == 0) {
                $.messager.alert('操作提示', '请选择数据!', 'warning');
                return false;
            }
            var userguidcontent = "";
            for (var i = 0; i < rows.length; i++) {
                userguidcontent += rows[i].Id + ";";
            }

            $('#UserGuidContent').val(userguidcontent);
            $('#loadedit').click();

        }
        $(function () {


            formbind();
        });
        function formbind() {
            $("form").unbind("submit");

            $("form").submit(function (form) {

                ajaxFrom2(this, this.action);

            });
        }
        function ajaxFrom2(form, url) {

            $.ajax({
                url: url,
                type: "Post",
                data: $(form).serialize(),
                dataType: "json",
                success: function (data) {


                    if ($.messager) {
                        $.messager.defaults.ok = '继续';



                        $.messager.alert('操作提示', data, function (r) {

                        });
                    }

                }
            });
        }
    </script>
</asp:Content>

